#include "GameService.h"
using namespace SGLib;

SINGLETON_CLASS_INIT(CGameServiceManager);
	
void CGameServiceManager::DestoryGameService()
{
	if( m_service )
	{
		delete m_service;
		m_service = NULL;
	}
}

IGameService* CGameServiceManager::GetGameService()
{
	return m_service;
}

SGLib::IPacketParser* CGameServiceManager::GetPacketParser()
{
	if( m_service )
	{
		return m_service->GetPacketParser();
	}
	return NULL;
}

s32 CGameServiceManager::AddTimer(u32 elapse, SGLib::CallBackFunc func, void *data, s32 len, bool isPersist)
{
	if( m_service )
	{
		return m_service->AddTimer( elapse, func, data, len, isPersist );
	}
	return SGLib::CTimer<1>::E_Invalid_TimerId;
}

void CGameServiceManager::DelTimer(s32 nTimerId)
{
	if( m_service )
	{
		m_service->DelTimer( nTimerId );
	}
}
